package com.example.service.impl;

import com.example.dao.VoteDao;
import com.example.entity.Vote;
import com.example.service.VoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class VoteServiceImpl implements VoteService {
    @Resource
    VoteDao voteDao;

    @Override
    public List<Vote> queryAllVote() {
        log.info(voteDao.queryAllVote().toString());
        return voteDao.queryAllVote();
    }

    @Override
    public boolean addVote(String id, String count) {
        if(id==null){
            log.info("id为空");
            return false;
        }
        if(count==null){
            log.info("票数为空");
            return false;
        }
        return voteDao.Vote(id,count);
    }
}
